#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm commitlint

# 获取当前提交信息
# COMMIT_MSG=$(git log --format=%B -n 1 HEAD)

# # 检查是否是合并提交
# if echo "$COMMIT_MSG" | grep -qE "^Merge branch"; then
#     echo "merge colleagues' commit" >&2
# else
#     # 正则表达式匹配提交信息格式，包含指定的提交类型
#     PATTERN="^(feat|fix|chore|docs|test|style|refactor|perf|build|revert): .+"

#     # 检查提交信息格式是否正确
#     if ! echo "$COMMIT_MSG" | grep -qE "^(feat|fix|chore|docs|test|style|refactor|perf|build|revert): .+"; then
#         echo "${RED}Commit invalid!${NC} Correct format is: <type>: <subject>" >&2
#         exit 1
#     fi

#     # 检查提交信息长度是否超过88个字符
#     if [ "${#COMMIT_MSG}" -gt 10 ]; then
#         echo "${RED}Aborting commit.${NC} Your commit message is too long." >&2
#         exit 1
#     fi
# fi